﻿using System.Net;
using System.Net.Sockets;

using GCC.Container.Abstracts;

namespace GCC.Container.Comm.Modbus.TCPVersion
{
    public class Server : AbsCommTCPServer<ModbusTcpPackage>
    {
        public Server(IPEndPoint iPEndPoint, AbsGCCLogger logger, string name) : base(iPEndPoint, logger, name)
        {
        }



        /// <summary>
        /// 获取一个与当前服务一致的客户端
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="localInfo">本地地址信息</param>
        /// <returns></returns>
        public override AbsCommTcpClient<ModbusTcpPackage> GetClient(string name, IPEndPoint? localInfo = null)
        {
            return new Client(_ipendPoint, _logger, name, localInfo);
        }

        public override AbsCommTcpClient<ModbusTcpPackage> GetClient(string name, Socket socket)
        {
            return new Client(_ipendPoint, _logger, name, socket);
        }
    }
}
